import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {RfidReaderForm, RfidReaderQuery, RfidReaderVO} from '@/api/painting/rfidReader/types';

/**
 * 查询RFID读写器管理列表
 * @param query
 * @returns {*}
 */

export const listRfidReader = (query?: RfidReaderQuery): AxiosPromise<RfidReaderVO[]> => {
  return request({
    url: '/painting/rfidReader/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询RFID读写器管理详细
 * @param id
 */
export const getRfidReader = (id: string | number): AxiosPromise<RfidReaderVO> => {
  return request({
    url: '/painting/rfidReader/' + id,
    method: 'get'
  });
};

/**
 * 新增RFID读写器管理
 * @param data
 */
export const addRfidReader = (data: RfidReaderForm) => {
  return request({
    url: '/painting/rfidReader',
    method: 'post',
    data: data
  });
};

/**
 * 修改RFID读写器管理
 * @param data
 */
export const updateRfidReader = (data: RfidReaderForm) => {
  return request({
    url: '/painting/rfidReader',
    method: 'put',
    data: data
  });
};

/**
 * 删除RFID读写器管理
 * @param id
 */
export const delRfidReader = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/rfidReader/' + id,
    method: 'delete'
  });
};
